package com.star.test.entity;

import java.util.ArrayList;
import java.util.List;

public class Customer implements Comparable<Customer>{
    private String name;
    private int consumption;

    public Customer(String name, int consumption) {
        this.name = name;
        this.consumption = consumption;
    }

    @Override
    public String toString() {
        return "Customer{" +
                "name='" + name + '\'' +
                ", consumption=" + consumption +
                '}';
    }
    //Java 中的一个泛型接口，用于定义对象之间的自然排序（natural ordering）
    @Override
    public int compareTo(Customer other) {
        return Integer.compare(this.consumption, other.consumption);
    }
}
